# -*- coding:utf-8 -*-
import socket
import os

print "IP = ", os.getenv("IP", '0.0.0.0')
print "PORT = ", os.getenv("PORT", 8080)

port = 31500 
ip = "localhost"

address = (ip, port)

print address

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)  # s = socket.socket()
s.bind(address)
s.listen(5)
ss, addr = s.accept()
print 'got connected from', addr
ss.send('byebye')
ra = ss.recv(512)
print ra
ss.close()
s.close()